<?php

class Admin_RoomcatsController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {    
        $this->_helper->layout()->disableLayout();
        Zend_Loader::loadFile('../application/admin/models/Roomcats.php');
        $roomcats_model = new roomcats();
        $roomcats_arr = $roomcats_model->listroomcats();
        //print_r($roomcats_arr); EXIT;
        $this->view->roomcats_arr = $roomcats_arr;     
    }
    
    public function addAction()
    {
        $this->_helper->layout()->disableLayout();
		Zend_Loader::loadFile('../application/admin/forms/Roomcats.php');
		Zend_Loader::loadFile('../application/admin/models/Roomcats.php');
        $Roomcats_form = new Form_Roomcats();
        $this->view->roomcats_form = $Roomcats_form;
    }
    
    public function doaddroomcatAction()
    {
    	$this->_helper->layout()->disableLayout();
    	Zend_Loader::loadFile('../application/admin/models/Roomcats.php');
		Zend_Loader::loadFile('../application/admin/forms/Roomcats.php');
        $roomcat_form = new Form_Roomcats();
		$mod_roomcat = new Roomcats();
		$request = $this->getRequest();
		
   		if ($request->isPost()) {            			
			$form_values = $request->getPost();
			$add_roomcat = $mod_roomcat->addRoomcats($form_values);
		}	
    }

    public function editAction()
    {
    	$this->_helper->layout()->disableLayout();
        Zend_Loader::loadFile('../application/admin/forms/Roomcats.php');
        Zend_Loader::loadFile('../application/admin/models/Roomcats.php');
        $mod_roomcats = new Roomcats();
        $roomcats_form = new Form_Roomcats();
        $request = $this->getRequest();
        $roomcat_id = $request->getParam('roomcat_id');
        $this->view->roomcat_id = $roomcat_id;
        $roomcat_arr = $mod_roomcats->getRoomcats($roomcat_id);
       
        $roomcat_arr = $mod_roomcats->getRoomcats($roomcat_id);
        $this->view->roomcat_arr = $roomcat_arr;
    }

    public function deleteAction()
	{
		$this->_helper->layout()->disableLayout();
		Zend_Loader::loadFile('../application/admin/models/Roomcats.php');
	    $Roomcats_model = new Roomcats();
		$this->_helper->layout->setLayout('admin');	
	    $roomcat_id = $this->_getParam('id', 0);	    
	    $Roomcats_model->deleteRoomcats($roomcat_id);
	    $this->_helper->redirector('index');
	}
	
	public function updateroomcatAction()
	{
		$this->_helper->layout()->disableLayout();
		Zend_Loader::loadFile('../application/admin/models/Roomcats.php');
		$Roomcats_model = new Roomcats();
		
		if ($this->getRequest()->isPost()) {
            $formData = $this->getRequest()->getPost();
            $update_rromcat = $Roomcats_model->updateRoomcats($formData);
		}
	}
}